<?php

//////////////////////////////////////////////////////
// GPAC Database is Copyright 2002 Colin Todd       //
// Written by Colin Todd - All rights reserved.     //
//                                                  //
// colintodd@myfastmail.com                         //
//////////////////////////////////////////////////////

//check user is logged in
include_once('_includes/master_include.php');

$root = './';
include($root . 'include/config.php');
include($root.'include/functions.php');



echo"<title>$SoftwareShortName : $SoftwareLongName v$SoftwareVersion</title>"; 

?>
<link rel="stylesheet" href="include/style.css" type="text/css">
<script language="JavaScript" type="text/javascript" src="include/scripts.js"></script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="10" topmargin="10" marginwidth="0" marginheight="0">
<?
include($root . 'include/dbconnect.php');

$fixSQL = urldecode(html_entity_decode(@$_GET['fixSQL']));
//$fixSQL = urldecode($fixSQL);
$report = urldecode(html_entity_decode(@$_GET['report']));
$link = html_entity_decode(@$_GET['link']);
//$link = urldecode(html_entity_decode(@$_GET['link']));
$message= urldecode(html_entity_decode(@$_GET['message']));

//PRINT "REPORT IS : <pre>$report</pre> <P>";
//PRINT "Link IS   : <pre>$link</pre><P>";
//PRINT "message IS :<pre>$message</pre> <P>";

//exit;
?>
<center>
<table cellpadding="5">
<tr>
<td class="style1">
<table class="content1">
<tr>
<td class="content1">
<br /><font class="titlename2"><center>&nbsp;Preview&nbsp;Report&nbsp;</center></font><p>
<p>
<center>
<?php

//echo "<pre>";
//print_r($_GET);
//echo "<pre>$fixSQL</pre><p>";
//$result = mysql_query($fixSQL);
//echo "<p><b>&nbsp;";
//if($result) {
//	echo mysql_affected_rows()."&nbsp;record&nbsp;sucessfully&nbsp;updated&nbsp;!<p>";
//}else {
//	echo "Error&nbsp;updating&nbsp;record&nbsp;!<p>";
//}


if(strpos ( $report, "CSV_Fmly")) {
echo "<p><a href=\"".$report.$link."&CSVOutput=TRUE&XMLOutput=FALSE".$message."\" class=\"reportlink\" >CSV Report</a><p>\n";

} else {

echo "<p><a href=\"".$report.$link."&CSVOutput=FALSE&XMLOutput=FALSE".$message."\" class=\"reportlink\">PDF  Report</a><p>\n";
}


if(strpos ( $report, "ChurchDirectory") or strpos ( $report, "Spreadsheet_Indv")) {
echo "<p><a href=\"reports/ChurchDirectory_A5.php".$link."&CSVOutput=TRUE&XMLOutput=FALSE".$message."\" class=\"reportlink\" >CSV Report</a><p>\n";
echo "<p><a href=\"reports/ChurchDirectory_A5.php".$link."&CSVOutput=FALSE&XMLOutput=TRUE".$message."\" class=\"reportlink\" >XML Report</a><p>\n";
	// use following lines
}
 
echo "<font class=\"smalltxt\">PDF Report requires Adobe Acrobat Reader<br /><a href=\"http://www.adobe.com/\">www.adobe.com</a></font> ";

echo "<pre>";
//print_r($link);
//echo $link['reports'];

?> 
</center>
</td></tr></table>
</td></tr></table></center>